package day5.demo2_顺序执行;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class PoolDemo {
    static ExecutorService pool = Executors.newSingleThreadExecutor();
    public static void main(String[] args) throws Exception {
        Thread t1 = new Thread(() -> {
            System.out.println("1.项目需求分析");
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {}
        });
        Thread t2 = new Thread(() -> {
            System.out.println("2.项目方案设计");
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {}
        });
        Thread t3 = new Thread(() -> System.out.println("3.项目编码"));
        pool.submit(t1);
        System.out.println("t1提交");
        pool.submit(t2);
        System.out.println("t2提交");
        pool.submit(t3);
        System.out.println("t3提交");
        pool.shutdown();
    }
}